package javango.forms.widgets;

import java.util.Map;

public class Util {

	public static void flatatt(Map<String, Object> att, StringBuilder b) {		
		for (Map.Entry<String, Object> entry : att.entrySet()) {
			if (entry.getValue() == null) {
				b.append(String.format(" %s", entry.getKey()));
			} else {
				b.append(String.format(" %s=\"%s\"", entry.getKey(), entry.getValue()));
			}
		}		
	}
	
	public static String flatatt(Map<String, Object> att) {
		StringBuilder b = new StringBuilder();
		flatatt(att, b);
		return b.toString();
	}
}
